import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQml 2.12

Item
{
    property alias list: girdRepeater.model
    Grid
    {
        id:girdLayout
        anchors.fill: parent
        columns: 5

        Repeater
        {
            id:girdRepeater
            Frame
            {
                padding: 10

                width: parent.width*0.2
                height: parent.height*0.2+30
                background: Rectangle
                {
                    id:background
                    color:"#00000000"
                    radius:5
                }
                clip: true

                MusicBorderImage
                {
                    id:img
                    height: parent.height-30
                    width: parent.width
                    imgSrc: modelData.coverImgUrl
                }

                Text
                {
                    anchors
                    {
                        top:img.bottom
                        horizontalCenter:parent.horizontalCenter
                    }
                    text: modelData.name
                    font.family: window.m_FONT_FAMLIY
                    height: 30
                    width: parent.width
                    verticalAlignment: Text.AlignVCenter
                    horizontalAlignment: Text.AlignHCenter
                    elide: Qt.ElideMiddle
                    color: "#eeffffff"
                }

                MouseArea
                {
                    anchors.fill: parent
                    hoverEnabled: true
                    cursorShape: Qt.PointingHandCursor
                    onEntered:
                    {
                        background.color = "#50ffffff"
                    }
                    onExited:
                    {
                        background.color = "#00000000"
                    }

                    onClicked:
                    {
                            var item = girdRepeater.model[index]
                            //打开歌单
                            pageHomeView.showPlayList(item.id, "1000")
                    }
                }
            }
        }
    }
}
